from dataclasses import dataclass
from typing import TypedDict, NotRequired

from pydantic import BaseModel, EmailStr, PositiveInt


class Person_TypedDict(TypedDict):
    name:str
    # age:int
    age:NotRequired[int]
    is_active:bool

@dataclass(frozen=True, order=True)
class Person_Dataclass:
    name:str
    age:int  = None
    city:str="Unknown"# 默认值

class Person_BaseModel(BaseModel):
    name: str
    age: PositiveInt | None = None   # swagger和redoc页面显示非强制参数
    email: EmailStr